package com.xinqi.modules.databank.v2.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.databank.dto.rsp.StudentScoreResultDTO;
import com.xinqi.modules.databank.v2.domain.CourseResourceStudentLogEntity;
import com.xinqi.modules.databank.v2.manager.CourseResourceStudentLogManager;
import com.xinqi.modules.databank.v2.mapper.CourseResourceStudentLogMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资料库学生日志记录-Manager层
 * @author dzy
 */
@Service
@RequiredArgsConstructor
public class CourseResourceStudentLogManagerImpl extends BaseServiceImpl<CourseResourceStudentLogMapper, CourseResourceStudentLogEntity> implements CourseResourceStudentLogManager {

    private final CourseResourceStudentLogMapper resourceStudentLogMapper;


    /**
     * 获取学生日志记录
     * @author dzy
     */
    @Override
    public List<CourseResourceStudentLogEntity> listByContentId(Long contentId) {
        LambdaQueryWrapper<CourseResourceStudentLogEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CourseResourceStudentLogEntity::getContentId, contentId);
        return list(wrapper);
    }

    /**
     * 获取学生得分记录 分数倒叙
     * @author dzy
     */
    @Override
    public List<StudentScoreResultDTO> studentScoreList(Long contentId) {
        return resourceStudentLogMapper.selectStudentScoreList(contentId);
    }

}
